package com.zjj.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zjj.entity.Employee;
import com.zjj.mapper.EmployeeMapper;
import com.zjj.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployServiceImpl implements EmployeeService {
    @Autowired
    EmployeeService employeeService;

    @Override
    public PageInfo<Employee> getList(String empName, String jobTitle, Integer pageNum) {
        PageHelper.startPage(pageNum,5);
        List<Worker> workerList = workerMapper.getList(empName,jobTitle);
        PageInfo<Worker> pageInfo = new PageInfo<>(workerList);
        return pageInfo;
    }

    @Override
    public PageInfo<Worker> getPage(String empName, String jobTitle, Integer pageNum) {
        PageHelper.startPage(pageNum,3);
        List<Worker> workerList = workerMapper.getList(empName,jobTitle);
        PageInfo<Worker> pageInfo = new PageInfo<>(workerList);
        return pageInfo;
    }

    @Override
    public Worker getWorkerInfo(Integer employeeId) {
        return workerMapper.getWorkerInfo(employeeId);
    }

    @Override
    public int saveBook(Worker worker) {
        return workerMapper.saveWorker(worker);
    }
}
